// 以背景图片
import 'package:flutter/material.dart';
import 'package:flutter_hooks/flutter_hooks.dart';
// svg
import 'package:flutter_svg/flutter_svg.dart';

class BgSvgBox extends HookWidget {
  const BgSvgBox(
      {super.key,
      this.borderRadius,
      required this.svgPicture,
      this.child,
      this.height,
      this.padding,
      this.bgColor});
  final BorderRadiusGeometry? borderRadius;
  final SvgPicture svgPicture;
  final Widget? child;
  final double? height;
  final EdgeInsetsGeometry? padding;
  final Color? bgColor;
  @override
  Widget build(BuildContext context) {
    return Container(
      height: height,
      clipBehavior: Clip.hardEdge,
      decoration: BoxDecoration(
          color: bgColor,
          borderRadius: borderRadius ?? BorderRadius.circular(0)),
      child: Stack(children: [
        svgPicture,
        Positioned(
            child: Container(
          padding: padding,
          width: double.infinity,
          height: height,
          child: child,
        ))
      ]),
    );
  }
}
